package com.gopay.common.cps.dao.cbrmb.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.gopay.common.base.dao.impl.BaseDAOImpl;
import com.gopay.common.cps.dao.cbrmb.CbRmbTranAssistDtlLogDao;
import com.gopay.common.domain.cbrmb.CbRmbTranAssistDtlLog;
@Repository(value = "cbRmbTranAssistDtlLogDao")
public class CbRmbTranAssistDtlLogDaoImpl extends BaseDAOImpl<CbRmbTranAssistDtlLog,Integer> implements CbRmbTranAssistDtlLogDao {

	@Override
	public CbRmbTranAssistDtlLog findByGopayOrderId(String orderId) {
		String hql = " select m from CbRmbTranAssistDtlLog m where m.gopayOrderId = '"
				+ orderId + "'";
		List<CbRmbTranAssistDtlLog> ss = findByHql(hql);
		return (null == ss || 0 == ss.size()) ? null : ss.get(0);
	}

    @Override
    public List<CbRmbTranAssistDtlLog> findByGopayOrderIdSortWithCreateTime(String gopayOrderId) {
        String hql = "from CbRmbTranAssistDtlLog where gopayOrderId = :orderId and tranType in ('0','2') order by createTime ASC";
        Map<String, Object> param = new HashMap<>();
        param.put("orderId", gopayOrderId);
        return super.findByHql(hql, param);
    }
	
}
